package gtkwire.listener.connector;

import gtkwire.*;
import gtkwire.widget.GtkWidget;
import gtkwire.listener.FilteringGTKMessageListener;
import gtkwire.listener.ToggleListener;

public class ToggleListenerFilter extends FilteringGTKMessageListener
{
	public ToggleListenerFilter( ToggleListener l )
	{
		super( l );
		addFilteringWidgetType( GtkWidget.WT_GtkToggleButton );
		addFilteringWidgetType( GtkWidget.WT_GtkCheckButton );
		addFilteringWidgetType( GtkWidget.WT_GtkRadioButton );
		setMatchMode( this.MUST_MATCH_NAME_AND_WIDGET );
	}
	
	public void filteredMessage( GTKWireMessage msg )
	{
		String msgString = msg.getMessageObjectString();
		boolean val = msgString.equals( "down" );
		((ToggleListener)listener).buttonToggled( val, msg );
	}

}//end class